package com.wx.chapter8.homework13;

/**
 * ClassName:Teacher
 * Package :com.wx.chapter8.homework13
 * Description :
 *
 * @Author : coder_mu
 * @Create : 2023/5/29 - 20:30
 */
public class Teacher extends Person {
    private int work_age;//教师特有的属性 工龄

    public Teacher(String name, char gender, int age) {
        super(name, gender, age);
    }

    //满参数构造器
    public Teacher(String name, char gender, int age, int work_age) {
        super(name, gender, age);
        this.work_age = work_age;
    }

    //教师教书
    public void teach() {
        System.out.println("我承诺，我会认真教学");
    }

    @Override
    public String play() {
        return super.getName() + "爱玩象棋";
    }

    //打印信息方法
    @Override
    public void printInfo() {
        super.printInfo();
        System.out.println("工龄:" + this.work_age);
        teach();
        System.out.println(play());
    }

    @Override
    public String toString() {//重写父类toString()方法
        return "Teacher{" +
                "name='" + getName() + '\'' +
                ", gender=" + getGender() +
                ", age=" + getAge() +
                '}';
    }
}